﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Abs_classes_data;
using System_States_Signals;

namespace Conc_classes_data
{
    public class trk_controller : abs_controller
    {
        public trk_controller(abs_controlled_object obj, Double normal_value)
            : base(obj, normal_value)
        {
            State = Controller_State.Stopped;
        }

        protected override void Create_Sensor(abs_controlled_object obj)
        {
            trk_sensor sens = new trk_sensor((tank)obj);
            this._sensor = sens;
        }      

        public override System_States_Signals.Value_State Check_statement()
        {
            Value_State s = Value_State.Normal;
            //if (abs_sensor.Not_Initialized == this._sensor.Value)
            //{
            //    s = Value_State.Not_Initialized;
            //}

            //if (this._sensor.Value < 50)
            //{
            //    s = Value_State.Crash;
            //}
            //else
            //{
            //    if (this._sensor.Value < this._normal_value - 50)
            //    {
            //        s = Value_State.Check;
            //    }
            //    else
            //    {
            //        s = Value_State.Normal;
            //    }
            //}
            //Console.WriteLine(s.ToString());
            return s;
        }

        public override void Do_Work(double value)
        {
            if (value > 100)
            {
                this.State = Controller_State.Working;
            }
            else
            {
                this.State = Controller_State.Stopped;
            }
        }

        public override void Do_Crash()
        {
            throw new NotImplementedException();
        }
    }
}
